package dxn.nl.file.biz.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import dxn.nl.file.biz.ExportStatusEnum;
import dxn.nl.file.biz.hander.JsonObjectTypeHandler;
import dxn.nl.file.biz.hander.StringListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper=false)
@TableName("file_export_apply")
public class FileExportApplyDetail {
    private Long id;

    @Schema(title = "网点编号")
    private String orgCode;

    @Schema(title = "网点名称")
    private String orgName;

    @Schema(title = "appId")
    private String appId;

    @Schema(title = "模块编号")
    private String modeCode;

    @Schema(title = "模块名称")
    private String modeName;

    @Schema(title = "导出类型，0 主动消费 1 客户端推送")
    private Integer exportTypeCode;

    @Schema(title = "tag")
    private String tag;

    @Schema(title = "导出请求参数")
    @TableField(typeHandler = JsonObjectTypeHandler.class)
    private Object param;

    @Schema(title = "导出文件列")
    @TableField(typeHandler = StringListTypeHandler.class)
    private List<String> exportColumn;

    @Schema(title = "申请时间")
    private LocalDateTime applyTime;

    @Schema(title = "申请用户编号")
    private String applyUserCode;

    @Schema(title = "申请用户名称")
    private String applyUserName;

    @Schema(title = "导出文件名称")
    private String fileName;

    @Schema(title = "开始执行时间")
    private LocalDateTime startTime;

    @Schema(title = "结束时间")
    private LocalDateTime endTime;

    @Schema(title = "状态")
    private Integer status;

    @Schema(title = "备注名称")
    public String getStatusName()
    {
        return ExportStatusEnum.getName(status);
    }

    @Schema(title = "备注")
    private String remark;

    @Schema(title = "异常信息")
    private String message;

    @Schema(title = "导出文件服务路径")
    @TableField(typeHandler = StringListTypeHandler.class)
    private List<String> fileUrl;

    @Schema(title = "总条数")
    private Integer totalRows;

    private Long versionNo;

    private Integer consumerStatus;
    private Integer consumerCount;
    private LocalDateTime consumerRefreshTime;
}
